/*
 * @Description: 封装组织机构请求
 * @Version: @1.0.0
 * @Autor: YJY
 * @Date: 2021-06-24 08:19:00
 * @LastEditors: YJY
 * @LastEditTime: 2021-06-29 11:28:23
 */
import request from '@/utils/request'

// 登录接口
export function getDepartments() {
  // 返回一个axios对象 => promise 对象
  return request({
    url: '/company/department'
  })
}

/** *
 *  根据id根据部门  接口是根据restful的规则设计的   删除 delete  新增 post  修改put 获取 get
 * **/
export function delDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

// 新增部门接口
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

//  获取部门详情
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

// 编辑部门
export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
